package ro.one.gaeql.model;

public class StringOperatorEvaluator implements OperatorEvaluator {
	@Override
	public Object eval(Object leftValue, AssignExpressionOperator op, Object rightValue) {
		if (!(leftValue instanceof String && rightValue instanceof String)) {
			throw new RuntimeException("'right' and 'left' should both be of type String.");
		}
		
		String strLeft = (String)leftValue;
		String strRight = (String)rightValue;
		
		return strLeft + strRight;
	}

	@Override
	public boolean canHandle(AssignExpressionOperator op) {
		return op == AssignExpressionOperator.Concat;
	}

}
